<template>
  <div>
     <h1>分模块的vuex使用</h1>
     <h1>分模块的state:{{$store.state.cartStore.cartnum}}</h1>
     <h1>使用getters：{{$store.getters.cartnum}}</h1>
     <button @click="send">分模块的mutaions触发</button>
     <button @click="run">分模块的actions触发</button>
  </div>
</template>
<script>
export default {
   methods:{
    send(){
      // 分模块的mutations 触发
      //  this.$store.commit("分模块名/方法名","实参")
      this.$store.commit("cartStore/changeCart",180)
    },
    run(){
      //  this.$store.dispatch("分模块名/方法名","实参")
       this.$store.dispatch("cartStore/actNum",360)
    }
   }
}
</script>